<h1>RegisterCopy</h1>

<p>RegisterCopy is used to copy the item at the top of the stack to one of the Flash Player's
internal registers. The value is not removed from the stack. The number of registers supported was 
expanded in Flash 7 to 256.</p>

<table>

<tr>
<th nowrap>Field Name</th>
<th>Type</th>
<th>Size</th>
<th>Description</th>
</tr>

<tr>
<td nowrap valign="top"><a name="ActionType">Type</a></td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">8</td>
<td>Identifies the action when it is encoded.</td>
</tr>

<tr>
<td nowrap valign="top"><a name="ActionLength">Length</a></td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">16</td>
<td>The number of bytes in the rest of the encoded action. The total number of
bytes in the encoded action is Length+3.</td>
</tr>

<tr>
<td nowrap valign="top"><a name="ActionLength">register</a></td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">8</td>
<td>The number of the register to copy the value on the stack to.</td>
</tr>

</table>

<p>The Flash Player uses a stack to store values when executing the actions 
associated with a button being  pushed, frame being played, etc. If a value is 
used repeatedly in a calculation, it must be pushed onto the stack each time using 
an Push action. To speed up the execution of the calculation and reduce the 
amount of code required the value can be saved to one of the internal registers 
of the Flash Player using the RegisterCopy action. This copies the value 
currently at the top of the stack into the specified register. Pushing an 
RegisterIndex onto the stack creates a reference to the register so the 
Flash Player uses the value directly rather than pushing the value onto the stack 
then immediately popping to use the value in a calculation.</p>

<h2>History</h2>

<p>The RegisterCopy action represents the ActionStoreRegister action in the 
Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 5 
and expanded in Flash 7 to support up to 256 registers.</p>
